﻿#ifndef IWIDGET_H
#define IWIDGET_H

#include <QObject>
#include <QWidget>
QT_BEGIN_NAMESPACE
#include <QEvent>
#include <QPaintEvent>
#include <QMouseEvent>
QT_END_NAMESPACE

/**
* @brief     抽象窗口基类
* 1.自定义窗口基类
* @author    Wanglipeng
* @email     1594932770@qq.com
* @date      2021-11-24
*/

class IWidgetPrivate;
class IWidget:public QWidget
{
public:
    IWidget(QWidget* parent = Q_NULLPTR);
    virtual ~IWidget()override;

protected:
    bool eventFilter( QObject* Obj, QEvent * Event )override;
    void showEvent(QShowEvent * event)override;
    void mousePressEvent( QMouseEvent * event )override;
    void mouseMoveEvent( QMouseEvent * event )override;
    void paintEvent(QPaintEvent *event)override;

public:
    enum ThemeStyle
    {
        Blue,
        Black,
        Transparent
    };

    void SetThemeStyle( const ThemeStyle & Theme );
    /**************************************
    * @author    Wanglipeng
    * @date      2021-11-25
    * @说明      设置窗口标题
    ***************************************/
    void SetWindowTitle(const QString& TextName);

    /**************************************
    * @author    Wanglipeng
    * @date      2021-11-25
    * @说明      设置中心窗口，可添加QWidget以及QLayout
    ***************************************/
    void SetContentWidget(QObject * Object);

private:
    void InitHeaderTitle();
    void SetWidgetInCenter();
    QString GetThemeStyle(const QString FileName);

private slots:
    void on_maxButton_clicked();
    void on_minButton_clicked();

private:
    IWidgetPrivate* _P;
};

#endif // IWIDGET_H
